package com.homedo.odin.solution.service;

import com.homedo.core.common.base.service.BaseService;
import com.homedo.odin.solution.dao.UserProfileTrackMapper;
import com.homedo.odin.solution.model.dto.Visitor;
import com.homedo.odin.solution.model.entity.UserProfileTrack;
import java.util.List;
import org.springframework.stereotype.Service;

/**
 * <p> 用户简介访问记录 服务实现类 </p>
 *
 * @author HarveyDing
 * @since 2018-03-08
 */
@Service
public class UserProfileTrackServiceImpl extends BaseService<UserProfileTrackMapper, UserProfileTrack> {

    public List<Visitor> selectVisitorList(Integer userId) {
        return baseMapper.selectVisitorList(userId);
    }

    public void insert(Integer userId, Integer visitorId, String ipAddr) {
        UserProfileTrack track = new UserProfileTrack();
        track.setUserId(userId);
        track.setVisitorId(visitorId);
        track.setCreatedBy(visitorId);
        track.setVisitorIp(ipAddr);
        track.setModifiedBy(visitorId);
        baseMapper.insert(track);
    }
}
